﻿////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// <copyright>Copyright 2008-2011 Andreas Huber Doenni</copyright>
// Distributed under the GNU General Public License version 2 (GPLv2).
// See accompanying file License.txt or copy at http://phuse.codeplex.com/license.
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

namespace Phuse.Mime
{
    using System;
    using System.IO;

    using Phuse.IO;

    /// <summary>Processes the body of a binary entity.</summary>
    internal sealed class ImageBodyProcessor : UnstructuredContentProcessor, ILineProcessor<Body>
    {
        private readonly ImageBody result;

        /// <summary>See <see cref="ILineProcessor{T}.GetResult"/>.</summary>
        public Body GetResult()
        {
            this.result.SetContent(this.GetContent());
            return this.result;
        }

        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        internal ImageBodyProcessor(
            EncodingTransformation encodingTransformation, string subtype, Disposition disposition) :
            base(encodingTransformation)
        {
            this.result = new ImageBody(subtype) { Disposition = disposition };
        }
    }
}
